<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/home/include/init_home.jsp" %>
<%
	String returnUrl = StringUtil.nvl(request.getParameter("referUrl"));

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= HOME_NAME %></title>
	<%@ include file="/home/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#publisher_id').focus();
		//$('#seller_regist').click(function() {
		//	document.location.href = "./sellerRegist.jsp";
		//});

	});
	
	
	function fnSubmitForm() 
	{
		if (document.saveForm.publisher_id.value == "") {
			alert("아이디를 입력하세요");
			document.saveForm.publisher_id.focus();
			return false;
		}
		if (document.saveForm.publisher_pw.value == "") {
			document.saveForm.publisher_pw.focus();
			return false;
		}


		$.ajax({
			url: '/publisher/publisherLogin.do',
			type: "POST",
		    dataType: 'json',//html,text,json
		    data: { //파라미터
		    	publisher_id : $('#publisher_id').val(),
				publisher_pw : $('#publisher_pw').val()
		    },
		    error: function(data, status, err){
		    	alert(err);
		    },
			success: function(data){
				if (data.result) {
					if ($("#returnUrl").val()=="") {
						document.location.href = './salesList.jsp';	//data.nextUrl;
					} else {
						document.location.href = $("#returnUrl").val();
					}
				} else {
					$('#publisher_pw').val("");
					$('#publisher_pw').focus();
					alert(data.message);
				}
		    }
		});
		
		return false;
	}


	</script>
</head>
<body>
	<div id="wrap">
		<%@ include file="/publisher/include/header.jsp"  %>
		
		<div id="contents">
			<h2>발행자 로그인</h2>
			<div id="login">
            	<form name="saveForm" id="saveForm" method="post"  onsubmit="return fnSubmitForm()">
					<input type="hidden" name="returnUrl" id="returnUrl" value=""/>
					
					<div>
						<h3>아이디</h3> <input type="text" class="text" name="publisher_id" id="publisher_id"  value=""/>
					</div>
					<div>
						<h3>비밀번호</h3><input type="password" class="text" name="publisher_pw" id="publisher_pw" value="" />
					</div>
					<div>
						<h3>&nbsp;</h3>
						<input type="checkbox" class="checkbox" name="save_id" id="save_id" value="y" /> 아이디저장
					</div>
					<div>
						<h3>&nbsp;</h3>
						<input type="submit" class="btn" value="로그인"></input>
						<a href="./regist.jsp" class="btn" title="발행자등록" >발행자등록</a>
					</div>
				</form>
				
			</div>
			
             
		</div>
		
		<%@ include file="/publisher/include/footer.jsp"  %>		
	</div>

</body>
</html>
